package com.example.fileupload.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 健康检查结果DTO
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class HealthCheckResult {
    private boolean healthy;
    private String message;
    private long timestamp;
    private long responseTime; // 响应时间(毫秒)
    
    public HealthCheckResult(boolean healthy, String message, long responseTime) {
        this.healthy = healthy;
        this.message = message;
        this.responseTime = responseTime;
        this.timestamp = System.currentTimeMillis();
    }
    
    public boolean isExpired(long maxAgeMs) {
        return System.currentTimeMillis() - timestamp > maxAgeMs;
    }
}
